using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using NWN2Toolset;
using NWN2Toolset.Plugins;
using NWN2Toolset.NWN2.Views;
using TD.SandBar;


namespace HotkeysPlugin
{
    public class Main : INWN2Plugin
    {
        private MenuButtonItem m_cMenuItem;
        private Preferences m_Prefs = new Preferences ();
        private HotkeysAssignment hotkeysAssignment;
        

        public void Startup (INWN2PluginHost cHost) {
            this.m_cMenuItem = cHost.GetMenuForPlugin (this);
            this.m_cMenuItem.Activate += new EventHandler (this.LaunchPlugin);
            this.m_cMenuItem.Visible = false;
            hotkeysAssignment = new HotkeysAssignment ();
            NWN2ToolsetMainForm.App.KeyPreview = true;
            NWN2ToolsetMainForm.App.KeyDown += new KeyEventHandler (KeyDownHandler);
            NWN2ToolsetMainForm.App.MouseDown += new MouseEventHandler (OnMouseDown);
        }

        private void OnMouseDown (object obj, MouseEventArgs eArgs) {
            if (eArgs.Button == MouseButtons.Right) {
            }
        }
                
        
        private void KeyDownHandler (object obj, KeyEventArgs eArgs) {
            hotkeysAssignment.OnKeyDown (eArgs);

        }

        private void LaunchPlugin (object sender, EventArgs e) {
        }
        public void Load (INWN2PluginHost cHost) {
        }
        public void Unload (INWN2PluginHost cHost) {
        }
        public void Shutdown (INWN2PluginHost cHost) {
        }
        

        // Properties
        public string DisplayName {
            get {
                return "Hotkeys";
            }
        }
        public string MenuName {
            get {
                return "Hotkeys";
            }
        }
        public string Name {
            get {
                return "HotkeysPlugin";
            }
        }

        public MenuButtonItem PluginMenuItem {
            get {
                return this.m_cMenuItem;
            }
        }

        public object Preferences {
            get {
                return PrefsManager.prefs;
            }
            set {
                PrefsManager.prefs = (Preferences) value;
            }
        }
    }
}
